﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Phone_Client.Commands_Utils;

namespace Phone_Client.ViewModels
{
    public class SharingPageItemVM : IViewModelBase
    {
        #region Fields

        private String _title, _imagelink;
        private bool _isitemselected;
        private Visibility _isimagevisible;

        #endregion

        #region Properties

        public String Title 
        {
            get { return _title; }
            set
            {
                if (_title == value) return;
                _title = value;
                RaisePropertyChanged("Title");
            }
        }

        public bool IsItemSelected
        {
            get { return _isitemselected; }
            set
            {
                if (_isitemselected == value) return;
                _isitemselected = value;
                RaisePropertyChanged("IsItemSelected");
            }
        }

        public Visibility IsImageVisible
        {
            get { return _isimagevisible; }
            set
            {
                if (_isimagevisible == value) return;
                _isimagevisible = value;
                RaisePropertyChanged("IsImageVisible");
            }
        }

        public Uri CategorySource
        {
            get { return new Uri(_imagelink, UriKind.Relative); }
        }

        #endregion

        #region Commands

        #endregion

        #region Commands Functions

        #endregion

        #region Functions

        private void SetCategorySource(String category)
        {
            switch (category)
            {
                case "News":
                    _imagelink = "/Phone_Client;component/Images/phone_s_news.png";
                    break;
                case "Charm":
                    _imagelink = "/Phone_Client;component/Images/phone_s_sexy.png";
                    break;
                case "Recreation":
                    _imagelink = "/Phone_Client;component/Images/phone_s_recreation.png";
                    break;
                case "Economy":
                    _imagelink = "/Phone_Client;component/Images/phone_s_economy.png";
                    break;
                case "High-Tech":
                    _imagelink = "/Phone_Client;component/Images/phone_s_hightech.png";
                    break;
                case "Media":
                    _imagelink = "/Phone_Client;component/Images/phone_s_media.png";
                    break;
                case "Sport":
                    _imagelink = "/Phone_Client;component/Images/phone_s_sport.png";
                    break;
            }
        }
      
        #endregion

        #region Ctor

        public SharingPageItemVM(String title, String category)
        {
            if (!String.IsNullOrWhiteSpace(title) && !String.IsNullOrWhiteSpace(category))
            {
                _title = title;
                _isimagevisible = Visibility.Visible;
                _isitemselected = false;
                this.SetCategorySource(category);
            }
        }

        #endregion
    }
}
